import request from '@/utils/request'

export function getImageCode(sid) {
  return request({
    url: '/code/sendImageCode',
    responseType: 'arraybuffer',
    headers: {
      deviceId: sid
    },
    method: 'get'
  })
}

export function login(data) {
  return request({
    url: '/v1/authorize/user/login',
    headers: {
      deviceId: data.sid
    },
    method: 'post',
    data
  })
}

export function refreshLogin(data) {
  return request({
    url: '/v1/authorize/user/refresh',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/admin/v1/user/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/admin/v1/user/logout',
    method: 'get'
  })
}
